home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Learn Microsoft Visual Basic 6.0 Now
/
Learn Microsoft Visual Basic 6.0 Now (Microsoft Press)(X03-58607)(1998).ISO
/
media
/
chap08
/
b08a010.cc2
< prev
next >
Wrap
Text File
|
1998-06-07
|
2KB
|
39 lines
0, Drag-and-drop support is a simple
2, feature to add to your Visual Basic
3, applications. Before you create the effect, you'll
7, need to add a source object to your
8, form that you can drag and a target object
12, that you can drop objects on. In this
15, step-by-step example, we'll use a paper
17, image for the source object and a trash
20, can image for the target object. In Step
24, 1, you enable the source object for drag
27, and drop by setting its DragMode
29, property to 1. This action unhooks the source
33, object from its stationary position and
36, allows the user to drag it when the
37, program runs. In Step 2, you specify the icon
43, that will appear when the user drags
44, the source object. By default, Visual
47, Basic uses a rectangle to represent the
50, object being dragged. But, you can specify a
53, custom icon by setting the DragIcon
55, property. Try to use an icon that visually
60, describes what the drag-and-drop
61, operation will be accomplishing. In Step 3, you
67, write a DragDrop event procedure for
68, the target object. Visual Basic
71, automatically executes the target object's
73, DragDrop event procedure whenever a source
76, object is dropped on a target object during
79, the program. This is the place where you
81, run any commands associated with the
83, user's action. For example, if the user is
87, dragging a scrap text file onto the
90, trash can, you might remove the source
92, image from the screen, replace the empty
95, trash can with a burning trash can, and
98, delete the associated file. By following
101, these three fundamental steps, you can add
104, drag-and-drop support to any program.
106, END